package com.tongtailian.www.stir.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.tongtailian.www.stir.R;
import com.tongtailian.www.stir.adapter.ProductListAdapter;
import com.tongtailian.www.stir.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class ProductList extends BaseActivity {
    private RecyclerView recycleview;

    private ProductListAdapter productListAdapter;
    List<String> list = new ArrayList<>();

    String[] arr = {"TTL-200型全自动均质器",
            "TTL-260型全自动均质器",
            "TTL-HS型水质硫化物-酸化吹气仪",
            "TTL-6HS型水质硫化物-酸化吹气仪",
            "TTL-6SS型土壤（沉积物）硫化物酸化吹气仪",
            "TTL-800/801型萃取净化振荡器",
            "TTL-860系列全自动控温翻转振荡器",
            "TTL-DC型多功能氮吹仪",
            "TTL-DCⅠ/DCⅡ型氮吹仪",
            "TTL-DCⅢ型氮吹仪",
            "TTL-GDC型干浴氮吹仪",
            "TTL-100型进样瓶清洗机",
            "TTL-10型超纯水器",
            "TTL-20型RO反渗透纯水器",
            "TTL-30型超纯水器",
            "TTL-6型/TTL-8型超纯水器",
            "TTL-4SH型硫化氢爆气仪"};


    @Override
    public int setLayoutId() {
        return R.layout.activity_product_list2;
    }

    @Override
    public void initVariables() {
        setTitle("产品列表");
        for (int i = 0; i < arr.length; i++) {
            list.add(arr[i]);
        }
    }

    @Override
    public void initViews(Bundle savedInstanceState) {
        recycleview = findViewById(R.id.recycleview);

        productListAdapter = new ProductListAdapter(R.layout.adapter_item_product, list);
        recycleview.setLayoutManager(new LinearLayoutManager(this));
        recycleview.setAdapter(productListAdapter);

        productListAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {

                Intent intent = new Intent(ProductList.this, ProductInfoActivity.class);
                intent.putExtra("para", position);
                startActivity(intent);
                //  startActivity(new Intent(SplashActivity.this, ProductList.class));
//                startActivity();
            }
        });
    }

    @Override
    public void doBusiness() {

    }
}